import {EN} from './config'
const PixRatio = {
	init($event){
		this.$event = $event
		let mqString = `(resolution: ${window.devicePixelRatio}dppx)`;
		window.matchMedia(mqString).addListener(this.updatePixelRatio.bind(this));
		this.updatePixelRatio()
	},
	updatePixelRatio(){
		let pr = window.devicePixelRatio;
		let prString = (pr * 100).toFixed(0);
		let innerText = `${prString}% (${pr.toFixed(2)})`;
		console.log(innerText)
		this.$event.emit(EN.pixRatio,pr)
	}
}
export default PixRatio